package tt.dz.order.service.rpc.rpchander;

import java.util.List;

import org.apache.avro.generic.GenericRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import tt.dz.order.pojo.OrderServiceInfo;
import tt.dz.order.service.OrderService;
import tt.dz.order.vo.RetVO;

@Component("listOrderServiceInfoHander")
public class ListOrderServiceInfoHander implements BaseHander {
	private static Logger log = LoggerFactory.getLogger(ListOrderServiceInfoHander.class);
	@Autowired
	OrderService orderService;

	@Override
	public RetVO dohander(GenericRecord req) {
		RetVO retVO = new RetVO(RetVO.SuccessCode, null, null);
		// 服务列表查询
		try {
			List<OrderServiceInfo> list = orderService.listOrderServiceInfo();
			retVO.setBizData(list);
		} catch (Exception e) {
			log.error("服务列表查询发生异常", e);
			retVO.setRetCode(RetVO.FailCode);
			retVO.setResultCode("1020300");
			retVO.setErrorMsg(e.getMessage());
		}
		return retVO;
	}

}
